/*
 * @Author: gyc
 * @Date: 2020-01-08 09:50:33
 * @LastEditTime: 2020-05-22 09:16:40
 * @Description: Nuxt测试版
 */ 
import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
// import '@babel/polyfill'
import 'lib-flexible/flexible'
// import iView from 'iview'
import 'view-design/dist/styles/iview.css';
// import VueQuillEditor from 'vue-quill-editor'
// import "quill/dist/quill.core.css";
// import "quill/dist/quill.snow.css";
// import "quill/dist/quill.bubble.css";
// import Blob from '../excel/Blob.js'
// import Export2Excel from '../excel/Export2Excel.js'
// import infiniteScroll from 'vue-infinite-scroll'
import axios from 'axios'
import moment from 'moment'
// import VueAxios from 'vue-axios'
import '../my-theme/index.less';
// import VueParticles from 'vue-particles'  

import {
  store
} from './store/store'
import {
  Row,
  Col,
  Tooltip,
  Icon,
  Message
} from 'view-design';
Vue.config.productionTip = false
Vue.component('Row', Row);
Vue.component('Col', Col);
Vue.component('Tooltip', Tooltip)
Vue.component('Icon', Icon)
axios.defaults.withCredentials = true //跨域
Vue.prototype.$Message = Message
Vue.prototype.$axios = axios
Vue.prototype.$moment = moment
moment.locale('zh-cn')
// Vue.prototype.$baseUrl = process.env.BASE_URL
// Vue.use(infiniteScroll)
// Vue.use(VueQuillEditor, /* { default global options } */ )
// Vue.use(VueParticles)

// 超时时间
axios.defaults.timeout = 5000
// http请求拦截器
let message
axios.interceptors.request.use(config => {
  // message=Message.loading({
  //   content: 'Loading...',
  //   duration: 0
  // });
  return config
}, error => {
  loadinginstace.close()
  Message.error({
    message: '加载超时'
  })
  return Promise.reject(error)
})

// http响应拦截器
axios.interceptors.response.use(data => { // 响应成功关闭loading
  //   Message.success({
  //   content: '數據加載完成！',
  //   duration: 3
  // });
  // setTimeout(message, 0);
  return data
}, error => {
  Message.error({
    content: '加载失败！'
  })
  return Promise.reject(error)
})

new Vue({
  store: store, //使用store
  render: h => h(App),
  router,
  mounted() {
    document.dispatchEvent(new Event('render-event'))
  }
}).$mount('#app')